<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>
<body>
    
    <button>点击试试</button>
</body>
</html>
<!-- script标签可以放到页面最后面 -->
<script>
    document.querySelector('button').onclick= function(){
        alert('你还能揍我吗')
    }
</script>